<!DOCTYPE html>
<html class="um landscape min-width-240px min-width-320px min-width-480px min-width-768px min-width-1024px">
<head>
  <title>
    <!--升舱列表-->
  </title>
  <meta charset="utf-8">
  <meta name="viewport" content="target-densitydpi=device-dpi, width=device-width, initial-scale=1, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
  <link rel="stylesheet" href="css/project/ui-input-v3.css">
  <link rel="stylesheet" href="css/ui-base.css">
  <link rel="stylesheet" href="css/ui-box.css">
  <link rel="stylesheet" href="css/project/style.css">
  <link rel="stylesheet" href="css/zv_common.css">
  <link rel="stylesheet" href="css/project/ui-color-v3.css">
  <link rel="stylesheet" href="css/project/ui-res-v3.css">
  <link rel="stylesheet" href="css/iBox.css?v=202022">
  <link rel="stylesheet" href="css/base.css">
  <style>
    #condition{
        position: fixed;
        left:0;
        top:0;
        z-index: 20;
        background:red,
    }
    #candidates{
      position: absolute;
      top:0;
      left:0;
      width:100%;
    }
    .datecolor {
      color: #525252;
    }

    .b-norarea {
      border-color: #ccc;
    }

    .passenger_infoborder {
      border-bottom: 1px solid #e5e5e5;
    }

    .passenger_infoborderb {
      border: 0px;
    }
    .line-h {
      padding: 0.1em 0.3em 0.1em 0.3em;
      border-bottom: solid #cccccc 1px;
    }

    .line-h1 {
      padding: 0em 0.3em 0em 0.3em;
    }
    .umwh {
      min-width: 1.5em;
      min-height: 1.5em;
    }
  </style>
  <script src="js/zy_control.js"></script>
  <script src="js/zy_click.js"></script>
  <script src="js/jquery-3.1.1.min.js?v=202021"></script>
  <script src="js/main.js"></script>
  <script src="js/init.js"></script>
  <script src="js/iBox.js?v=202022"></script>
  <script src="js/common.js"></script>
  <script src="js/appcan.min.js"></script>
  <script src="js/candidate.js"></script>
  <script src="js/talkingdata.js"></script>
</head>

<body class="um-vp" ontouchstart style="background:#FFFFFF">
  <div id="page_1" class="ub ub-ver um-vp" style="height:100%;width:100%">
    <div id="condition">
      <div class="line-h c-wh">
        <div class="ub t-bla ub-ac">
          <div class=" ub-ac ulev0 datecolor ufl pt1">承运人:
          </div>
          <div class="ub-f1 ub uba  b-gra  sel noboder" style="width:45%">
            <div class="ub-f1 ut-s uinn tx-l t-gra ulh-sel" id="carrier">MU</div>
            <div class="b-gra  umw2 ub ub-pc ub-ac">
              <div class="ub-img umw1 umh1 res3"></div>
            </div>
            <select name="Carrier" selectedindex="0" id="Carrier" onchange="zy_selectmenu(this.id)">
  			                    	<option value="MU">MU</option>
  			                        <option value="FM">FM</option>
  			                        <option value="KN">KN</option>
  			                 </select>
    
          </div>
          <div class='ub b-norarea c-wh' style="width:55%">
            <div class=" ub-ac ulev0 datecolor ufl pt4">航班号:
            </div>
            <div class="ub ub-f1  ">
              <div class="uba uinput passenger_infoborderb" style="width:100%">
                <input placeholder="请输入航班号" type="tel" id="flightNo" style="width:100%" value="">
              </div>
            </div>
          </div>
        </div>
      </div>


      <div class="line-h c-wh">
        <div class="ub t-bla ub-ac">
          <div class='ub b-norarea c-wh' style="width:55%">
            <div class=" ub-ac ulev0 datecolor umw4 pt2">航班日期:</div>
            <div class="ub ub-f1">
              <div class="uba uinput passenger_infoborderb" id="flightDate" style="width:98%; line-height:1.7em" onclick="checked_day('flightDate')">请选择日期</div>
            </div>
          </div>
          <div class='ub b-norarea c-wh' style="width:45%">
            <div class=" ub-ac ulev0 datecolor umw4 pt2">是否值机:</div>
            <div class="ub-f1 ub uba  b-gra  sel noboder">
              <div class="ub-f1 ut-s tx-l t-gra ulh-sel" id="CheckinStatus" style="width:100%; line-height:1.7em">全部</div>
              <div class="b-gra ub ub-pc ub-ac">
                <div class="ub-img umw1 umh1 res3"></div>
              </div>
              <select name="chekStatus" selectedindex="0" id="checkinStatus" onchange="zy_selectmenu(this.id)">
  			                    	<option value="">全部</option>
  			                        <option value="AC">已值机</option>
  			                        <option value="NA">未值机</option>
  			                 </select>
            </div>
          </div>
        </div>
      </div>


      <div class="line-h c-wh">
        <div class="ub t-bla ub-ac">
          <div class='ub b-norarea c-wh' style="width:50%">
            <div class=" ub-ac ulev0 datecolor umw4 pt4">出发机场:</div>
            <div class="ub ub-f1  ">
              <div class="uba uinput passenger_infoborderb" style="width:100%">
                <input placeholder="SHA" type="text" id="oriEng" style="width:100%" value="">
              </div>
            </div>
          </div>
          <div class='ub b-norarea c-wh' style="width:50%">
            <div class=" ub-ac ulev0 datecolor umw4 pt4">到达机场:</div>
            <div class="ub ub-f1  ">
              <div class="uba uinput passenger_infoborderb" style="width:100%">
                <input placeholder="PEK" type="text" id="desEng" style="width:100%" value="">
              </div>
            </div>
          </div>
        </div>
      </div>

      <div class="line-h1 c-wh">
        <div class="ub-f1 ub uba  b-gra  sel noboder">
          <!--复选框开始-->
          <input type="checkbox" name="che1" class="uhide" value="Y" id="cabin_Y" checked="checked">
          <div onclick="zy_for(event)" ontouchstart="zy_touch('btn-act')" class="ub uc-a1 t-bla">
            <div class="che-icon ub-img umwh"></div>
          </div>
          <!--复选框结束-->
          <div class="ub-f1 ut-s uinn tx-l ulh-sel">经济舱</div>
          <!--复选框开始-->
          <input type="checkbox" name="che1" class="uhide" value="W" id="cabin_W">
          <div onclick="zy_for(event)" ontouchstart="zy_touch('btn-act')" class="ub uc-a1 t-bla">
            <div class="che-icon ub-img umwh"></div>
          </div>
          <!--复选框结束-->
          <div class="ub-f1 ut-s uinn tx-l ulh-sel">超级经济舱</div>
          <!--复选框开始-->
          <input type="checkbox" name="che1" class="uhide" value="J" id="cabin_J">
          <div onclick="zy_for(event)" ontouchstart="zy_touch('btn-act')" class="ub uc-a1 t-bla">
            <div class="che-icon ub-img umwh"></div>
          </div>
          <!--复选框结束-->
          <div class="ub-f1 ut-s uinn tx-l ulh-sel">公务舱</div>
        </div>
      </div>

      <div class="line-h1  c-wh">
        <div class="ub-f1 ub uba  b-gra  sel noboder">
          <!--复选框开始-->
          <input type="checkbox" name="che1" class="uhide" value="F" id="cabin_F">
          <div onclick="zy_for(event)" ontouchstart="zy_touch('btn-act')" class="ub uc-a1 t-bla">
            <div class="che-icon ub-img umwh"></div>
          </div>
          <!--复选框结束-->
          <div class="ub-f1 ut-s uinn tx-l ulh-sel">头等舱</div>
          <!--复选框开始-->
          <input type="checkbox" name="che1" class="uhide" value="U" id="cabin_U">
          <div onclick="zy_for(event)" ontouchstart="zy_touch('btn-act')" class="ub uc-a1 t-bla">
            <div class="che-icon ub-img umwh"></div>
          </div>
          <!--复选框结束-->
          <div class="ub-f1 ut-s uinn tx-l ulh-sel">豪华头等舱 </div>
          <!--复选框结束-->
          <div class="ub-f1 ut-s uinn tx-l t-gra ulh-sel">&nbsp;&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; </div>
        </div>
      </div>
    </div>
    <form action="javascript:;" method="get" id="search_form" name="search_form">

      <div class="ub ub-ver" style="clear:both;">

      </div>
    </form>
    <!---查询列表显示-->
    <div id="candidates">
     
    </div>
  </div>
  <div id="footer" ontouchstart="zy_touch('btn-act')" onclick="Points()" style="position:fixed; width:100%;bottom:0;" class="t-wh c-blu1 tx-c umh4 uhide" ontouchmove="return false;">确 定(<span id="checknum">0</span>)</div>
  <script>
    zy_init();
    var path = "http://jx.selfservice.ceair.com:6080/mckiserver/service/v1/sample";
    //var path = "http://172.31.68.222:7080/mckiserver/service/v1/sample"; //测试地址;
    var candidateList = '';
    window.uexOnload = function(type){
      if (!type) {
        //exitKeyPressedListener();
        $$("flightDate").innerHTML = getNowFormatDate().substr(0,11);
        IC.talkingDataCount("旅客升舱", "0003");
        //  if(/iphone|ipad|ipod/i.test(navigator.userAgent)) 
        // { 
        //      $("#condition").css("position", "static"); CandidateSort
        // };

      }
    
    }

    /**
     * 获取升舱列表
     */
    var imei = '';

    function CandidateUpgrade() {
      IC.talkingDataCount("旅客升舱", "0003");
      candidateList = '';
      reset(0);
      $("#candidates").empty();
      var url = path + "/CandidateUpgrade";
      var CarrierD = $$("Carrier").value; /*承运人*/
      var flightNoD = $$("flightNo").value; /*航班号*/
      var flightDateD =$$("flightDate").innerHTML.replace(/\s+/g,""); /*航班日期*/
      var oriEngD1 = $$("oriEng").value == "" ? "SHA" : $$("oriEng").value; /*出发机场3字码*/
      var oriEngD = oriEngD1.toUpperCase();
      var desEngD1 = $$("desEng").value == "" ? "PEK" : $$("desEng").value; /*到达机场3字码*/
      var desEngD = desEngD1.toUpperCase();
      imei = getDevice() == "" ? "340403199003170612" : getDevice();
      var arr = ['cabin_Y', 'cabin_U', 'cabin_J', 'cabin_W', 'cabin_F'];
      var SubClasslv = judgeChecked(arr);
      var CheckinStatus = $$("checkinStatus").value;
      //	flightNoD='5107';
      if (flightNoD == ''){
        $alert("航班号不能为空！");
        return;
      }
      //url="http://172.31.68.222:7080/mckiserver/service";
      var paramList = "<?xml version=\"1.0\" encoding=\"utf-8\" ?><candidateSortBean><carrier><![CDATA[MU]]></carrier><flightNo><![CDATA["+flightNoD+"]]></flightNo><depDt><![CDATA[" + flightDateD + "]]></depDt><oriEng><![CDATA[" +
        oriEngD + "]]></oriEng><desEng><![CDATA[" + desEngD + "]]></desEng><subclassLv><![CDATA[" + SubClasslv + "]]></subclassLv><checkinStatus><![CDATA[" + CheckinStatus + "]]></checkinStatus><calluser><![CDATA[" + calluser +
        "]]></calluser><username><![CDATA[" + username + "]]></username><password><![CDATA[" + password + "]]></password><imei><![CDATA[" + imei + "]]></imei></candidateSortBean>";


       // var paramList = "<?xml version=\"1.0\" encoding=\"utf-8\" ?><candidateSortBean><carrier><![CDATA[MU]]></carrier><flightNo><![CDATA[5111]]></flightNo><depDt><![CDATA[2017-09-14]]></depDt><oriEng><![CDATA[SHA]]></oriEng><desEng><![CDATA[PEK]]></desEng><subclassLv><![CDATA[Y]]></subclassLv><checkinStatus><![CDATA[]]></checkinStatus><calluser><![CDATA[CEAIRSHA003]]></calluser><username><![CDATA[CEAIRSHA003]]></username><password><![CDATA[SHA003]]></password><imei><![CDATA[340403199003170612]]></imei></candidateSortBean>";
      // alert(paramList);
      $.iBoxWait();
      $.ajax({
        type: "POST",
        contentType: "application/xml; charset=utf-8",
        url: url,
        data: paramList,
        dataType: "text", //"xml", "html", "script", "json", "jsonp", "text".
        success: function(data) {
          $.iBoxHide();
          json = JSON.parse(data);
          //						json=tjs;
          // console.log(json.candidateOutputBean);
          if (json.candidateOutputBean.errorCodeM == 0) {
            if (json.candidateOutputBean.mckiList.length) {
              //var data=json.candidateOutputBean.mckiList;
              LayOutList(data);
            } else {
              $alert("暂无数据！"); //暂无数据
            }
          } else{
             $alert(json.candidateOutputBean.errorCodeM);
            $alert(json.candidateOutputBean.errorMsgM);
          }
        },
        //调用出错执行的函数
        error: function(err) {
          $alert(err);
          $.iBoxHide();
          $alert("暂无相关信息！");
        }
      });
    }

    var paxname = ''; //旅客姓名
    var vip = ''; //VIP
    var subCbn = ''; //子舱位
    var mcv = ''; //MCV
    var sri = ''; //SRI
    var idNum = ''; //证件号码
    var idCard = ''; //证件号码显示全部
    var rankVal = ''; //级别
    var ffpLevel = ''; //金卡银卡
    var orderGrade = ''; //旅客排序

    var checkBoxArr = [];
    var checkNum = 0;

    function LayOutList(data) {
      IC.talkingDataCount("旅客升舱", "0003");
      var mckiList = data.substring(data.indexOf("[") + 1, data.indexOf("]"));
      var arrlist = mckiList.split("},{")
      for (var i = 0; i < arrlist.length; i++) {
        var subArr = arrlist[i].split(",");
        for (var j = 0; j < subArr.length; j++) {
          if (subArr[j].indexOf("idNum") > -1) {
            var arrId = subArr[j].split(":");
            idNum = arrId[1].substring(arrId[1].indexOf('"') + 1);
            idNum = idNum.replace('"', '');
            idCard = idNum;
            idNum = IdShowHandler(idNum);
          } else if (subArr[j].indexOf("paxname") > -1) {
            var arrName = subArr[j].split(":");
            paxname = arrName[1].substring(arrName[1].indexOf('"') + 1);
            paxname = paxname.replace('"', '');
            paxname = paxname.replace(/[\\]/g, ''); //过滤掉\字符
          } else if (subArr[j].indexOf("vip") > -1) {
            var arrVip = subArr[j].split(":");
            vip = arrVip[1].substring(arrVip[1].indexOf('"') + 1);
            vip = vip.replace('"', '');
          } else if (subArr[j].indexOf("subCbn") > -1) {
            var arrSubCbn = subArr[j].split(":");
            subCbn = arrSubCbn[1].substring(arrSubCbn[1].indexOf('"') + 1);
            subCbn = subCbn.replace('"', '');
            subCbn = subCbn.replace(/[^A-Za-z]/g, ''); //过滤掉字符以外字符
          } else if (subArr[j].indexOf("mcv") > -1) {
            var arrMcv = subArr[j].split(":");
            mcv = arrMcv[1].substring(arrMcv[1].indexOf('"') + 1);
            mcv = mcv.replace('"', '');
          } else if (subArr[j].indexOf("sri") > -1) {
            var arrSri = subArr[j].split(":");
            sri = arrSri[1].substring(arrSri[1].indexOf('"') + 1);
            sri = sri.replace('"', '');
          } else if (subArr[j].indexOf("rankVal") > -1) {
            var arrRankVal = subArr[j].split(":");
            rankVal = arrRankVal[1].substring(arrRankVal[1].indexOf('"') + 1);
            rankVal = rankVal.replace('"', '');
          } else if (subArr[j].indexOf("ffpLevel") > -1) {
            var arrFfpLevel = subArr[j].split(":");
            ffpLevel = arrFfpLevel[1].substring(arrFfpLevel[1].indexOf('"') + 1);
            ffpLevel = ffpLevel.replace('"', '');
          } else if (subArr[j].indexOf("orderGrade") > -1) {
            var arrOrderGrade = subArr[j].split(":");
            orderGrade = arrOrderGrade[1].substring(arrOrderGrade[1].indexOf('"') + 1);
            orderGrade = orderGrade.replace('"', '');
          }
        }
        

        var rcdStr = idCard + "|" + paxname;
        if (ffpLevel == '普通卡') {
          ffpLevel = '普卡';
        }
        //常客登机未空是不显示
        if (ffpLevel == '') {
          var candidateSubList = '<div class="uba umar-a cbg ub ub-ac" >\
							<div class="candidates " style="width:80%;" onclick="DetailPage(\'' + paxname + '\',\'' + idNum + '\',\'' + mcv + '\',\'' + sri +
            '\')">\
							<div class="ctxt"><div class="box"><span class="ctxtsp">姓名：</span>' + paxname + '</div><div class="box"><span class="ctxtsp">旅客排序：</span>' + orderGrade +
            '</div></div>\
							<div class="ctxt"><div class="box"><span class="ctxtsp">子舱位：</span>' + subCbn + '</div></div>\
							</div>\
							<div class="ub ub-ac">\
									<div class="ub ub uncheck" id="checkbox_' + rcdStr +
            '" onclick="checkIconClick(\'' + rcdStr + '\')" value="Click checkbox" value="uncheck"/></div>\
							</div>\
					   </div>';
        } else {
          if(ffpLevel=="null"||ffpLevel==null){
            ffpLevel="";
          }
          var candidateSubList = '<div class="uba umar-a cbg ub ub-ac" >\
							<div class="candidates " style="width:80%;" onclick="DetailPage(\'' + paxname + '\',\'' + idNum + '\',\'' + mcv + '\',\'' + sri +
            '\')">\
							<div class="ctxt"><div class="box"><span class="ctxtsp">姓名：</span>' + paxname + '</div><div class="box"><span class="ctxtsp">旅客排序：</span>' + orderGrade +
            '</div></div>\
							<div class="ctxt"><div class="box"><span class="ctxtsp">子舱位：</span>' + subCbn + '</div><div class="box"><span class="ctxtsp">常客等级：</span>' + ffpLevel +
            '</div></div>\
							</div>\
							<div class="ub ub-ac">\
									<div class="ub ub uncheck" id="checkbox_' + rcdStr + '" onclick="checkIconClick(\'' + rcdStr +
            '\')" value="Click checkbox" value="uncheck"/></div>\
							</div>\
					   </div>';
        }
        candidateList += candidateSubList;
        checkBoxArr.push(rcdStr);
      }
      //	var search_form=$$("search_form").offsetHeight;
      //	var bodyH = document.body.clientHeight;
      //	$$("candidates").style.height=(bodyH-search_form)+"px";
      $$("candidates").innerHTML = candidateList;

      var high=$("#page_1").height();
      var top=$("#condition").height();
      var top2=high-top;//页面加载列表 可滚动的高度;
        $("#candidates").css({
        "top":top,
        "left":"0",
        "height":top2,
         "overflow-y":"scroll",
        "-webkit-overflow-scrolling": "touch",
     })
    }
    function checkIconClick(rcdStr) {
      IC.talkingDataCount("旅客升舱", "0003");
      if ($$("checkbox_" + rcdStr).value == "check") {
        checkNum--;
        $$("checkbox_" + rcdStr).value = "uncheck";
        $$("checkbox_" + rcdStr).className = "ub ub uncheck";
      } else {
        checkNum++;
        $$("checkbox_" + rcdStr).value = "check";
        $$("checkbox_" + rcdStr).className = "ub ub check";

      }
      $$("checknum").innerHTML = checkNum;
      //	alert(checkNum)
      if (checkNum < 1) {
        $$("footer").className = "t-wh c-blu1 tx-c umh4 uhide";
      } else {
        $$("footer").className = "t-wh c-blu1 tx-c umh4";
      }
    }
    /**
     * num:0为重新请求数据 1为选中提交候补确定按钮
     * @param {Object} num
     */
    function reset(num) {
      IC.talkingDataCount("旅客升舱", "0003");
      if (num == 0) {
        checkBoxArr.length = 0;
      }
      checkNum = 0;
      $$("footer").className = "t-wh c-blu1 tx-c umh4 uhide";
      var len = checkBoxArr.length;
      for (var i = 0; i < len; i++) {
        $$("checkbox_" + checkBoxArr[i]).value = "uncheck";
        $$("checkbox_" + checkBoxArr[i]).className = "ub ub uncheck";
      }
    }

    function checkBoxStatus() {
      IC.talkingDataCount("旅客升舱", "0003");
      var paramUpList = '';
      var len = checkBoxArr.length;
      for (var i = 0; i < len; i++) {
        if ($$("checkbox_" + checkBoxArr[i]).value == "check"){
          var arr = checkBoxArr[i].split("|");
          paramUpList += "<passengerList><idNum><![CDATA[" + arr[0] + "]]></idNum><paxname><![CDATA[" + native2ascii(arr[1]) + "]]></paxname></passengerList>";
        }
      }
      return paramUpList;
    }
    function DetailPage(paxname, idNum, mcv, sri) {
      IC.talkingDataCount("旅客升舱", "0003");
      setStorage("candidateUpgrade_paxname", paxname);
      setStorage("candidateUpgrade_idNum", idNum);
      setStorage("candidateUpgrade_mcv", mcv);
      setStorage("candidateUpgrade_sri", sri);
      openNewWin('candidateUpgradeDetail', 'candidateUpgradeDetail.html');
    }
    /**
     * 升仓重新计算积分
     */
    var paramListHead = "<?xml version=\"1.0\" encoding=\"utf-8\"?><candidateUpgList>";
    var paramListEnd = "";

    function Points() {
      IC.talkingDataCount("旅客升舱", "0003");
      var url = path + "/CandidateUpgSri";
      //	var url ="http://172.28.28.77:8080/mckiserver/service/v1/sample/CandidateUpgSri";
      var paramUpList = checkBoxStatus();

      paramListEnd = "<calluser>" + calluser + "</calluser><username>" + username + "</username><password>" + password + "</password><imei><![CDATA[" + imei + "]]></imei></candidateUpgList>";

      var paramList = paramListHead + paramUpList + paramListEnd;
      //	console.log(paramList);
      $.iBoxWait();
      $.ajax({
        type: "POST",
        contentType: "text/xml; charset=utf-8",
        url: url,
        data: paramList,
        datatype: "json", //"xml", "html", "script", "json", "jsonp", "text".
        success: function(json) {
          $.iBoxHide();
          //console.log(JSON.stringify(json));
          if (json.candidateOutputBean.errorCodeM == 0) {
            reset(1);

            //						$alert("ok！");
            //						if(json.candidateOutputBean.mckiList.rankVal)
            //						{
            //							var rankVal=json.candidateOutputBean.mckiList.rankVal;
            //							$alert("积分值："+rankVal);
            //						}
            //						else{
            //							$alert("暂无数据！");   //暂无数据
            //						}
          } else {

            $alert(json.candidateOutputBean.errorMsgM);
          }
        },
        //调用出错执行的函数
        error: function(err) {
          $.iBoxHide();
          $alert("查询条件错误！");
        }
      });



    }


  </script>
</body>

</html>
